package com.seuic.hnapps.util;

import com.seuic.hnapps.bean.CardBinInfo_bean;
import com.solab.iso8583.IsoMessage;

import java.util.List;

public class MoneyUtil {
    public String packRequest(String moneys) {
        String money = "";
        String f3 = "";
        if (moneys.indexOf(".") != -1) {

            String moneylengs[] = moneys.split("\\.");
            if (moneylengs[1].length() == 2) {
                if (moneylengs[0].length() == 1) {
                    f3 = "000000000" + moneylengs[0] + moneylengs[1];
                } else if (moneylengs[0].length() == 2) {
                    f3 = "00000000" + moneylengs[0] + moneylengs[1];
                } else if (moneylengs[0].length() == 3) {
                    f3 = "0000000" + moneylengs[0] + moneylengs[1];
                } else if (moneylengs[0].length() == 4) {
                    f3 = "000000" + moneylengs[0] + moneylengs[1];
                } else if (moneylengs[0].length() == 5) {
                    f3 = "00000" + moneylengs[0] + moneylengs[1];
                } else if (moneylengs[0].length() == 6) {
                    f3 = "0000" + moneylengs[0] + moneylengs[1];
                } else if (moneylengs[0].length() == 7) {
                    f3 = "000" + moneylengs[0] + moneylengs[1];
                } else if (moneylengs[0].length() == 8) {
                    f3 = "00" + moneylengs[0] + moneylengs[1];
                } else if (moneylengs[0].length() == 9) {
                    f3 = "0" + moneylengs[0] + moneylengs[1];
                } else if (moneylengs[0].length() == 10) {
                    f3 = moneylengs[0] + moneylengs[1];
                }

            } else {
                money = moneys.replace(".", "");
                if (money.length() == 1) {
                    f3 = "0000000000" + money + "0";
                } else if (money.length() == 2) {
                    f3 = "000000000" + money + "0";
                } else if (money.length() == 3) {
                    f3 = "00000000" + money + "0";
                } else if (money.length() == 4) {
                    f3 = "0000000" + money + "0";
                } else if (money.length() == 5) {
                    f3 = "000000" + money + "0";
                } else if (money.length() == 6) {
                    f3 = "00000" + money + "0";
                } else if (money.length() == 7) {
                    f3 = "0000" + money + "0";
                } else if (money.length() == 8) {
                    f3 = "000" + money + "0";
                } else if (money.length() == 9) {
                    f3 = "00" + money + "0";
                } else if (money.length() == 10) {
                    f3 = "0" + money + "0";
                }
            }


        } else {
            money = moneys;
            if (money.length() == 1) {
                f3 = "000000000" + money + "00";
            } else if (money.length() == 2) {
                f3 = "00000000" + money + "00";
            } else if (money.length() == 3) {
                f3 = "0000000" + money + "00";
            } else if (money.length() == 4) {
                f3 = "000000" + money + "00";
            } else if (money.length() == 5) {
                f3 = "00000" + money + "00";
            } else if (money.length() == 6) {
                f3 = "0000" + money + "00";
            } else if (money.length() == 7) {
                f3 = "000" + money + "00";
            } else if (money.length() == 8) {
                f3 = "00" + money + "00";
            } else if (money.length() == 9) {
                f3 = "0" + money + "00";
            } else if (money.length() == 10) {
                f3 = money + "00";
            }
        }

        return f3;
    }
}
